package com.kcs.dc.service.utils;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;

public class SqlCreated {
	
	public static String createWhereClauseInParam(int repeatingNo){
		StringBuilder inClause = new StringBuilder();
		
		for (int i=0; i < repeatingNo; i++) {
		  inClause.append('?');
		  if (i != repeatingNo - 1) {
			  inClause.append(',');
		  }		  
		}				
		
		return inClause.toString();			
	} //#####End Method 	

	public static PreparedStatement setWhereClaseDoubleIn(PreparedStatement pmst, ArrayList<String> valueList) throws SQLException{
    	for (int i=0; i <valueList.size(); i++){
    		pmst.setString(i+1, valueList.get(i));
    		pmst.setString((valueList.size()+(i+1)), valueList.get(i));
    	}
		return pmst;		
	} //#####End Method
	
	public static PreparedStatement setWhereClaseInString(PreparedStatement pmst, ArrayList<String> valueList) throws SQLException{
    	for (int i=0; i <valueList.size(); i++){
    		pmst.setString(i+1, valueList.get(i));
    	}
		return pmst;		
	} //#####End Method 
	
}
